<%@ include file="/WEB-INF/views/commons/header.jsp" %>
<%@ include file="/WEB-INF/views/commons/menu.jsp" %>
<div id="boddy" name="boddy" style="position: absolute; cursor:wait; visibility:hidden; background-color:white; text-align: center; display:box; box-pack:center; box-align:center;" >
	<img alt="" src="<pc:GetUrlUriTags value="/resources/image/icons/waiting-wheel-300x300.gif" />" style="text-decoration: none; border-width: 0px; width: 100px; height: 100px;">
</div>
<!-- START BODY -->
<link href="<pc:GetUrlUriTags value="/resources/css/search/search.css" />" media="screen" rel="stylesheet" type="text/css" />
<table class="topSubject" width="100%" border="0">  
  <tr>
    <td height="30px"  width="34px">
    	<img alt="" src="<pc:GetUrlUriTags value="/resources/image/icons/png_apps/32x32/cloud-1.png" />" style="text-decoration: none; border-width: 0px;">
    </td>
    <td height="30px" align="left">
    	<div>
			<strong><a href="<pc:GetUrlUriTags value="/application/logs/list/index" />" class="topSubjectText">
			&nbsp;Application Logs
			</a></strong>
		</div>
    </td>
  </tr>
</table>

<div class="topSubject" style="width: 100%; height:auto; vertical-align: middle; text-align: center;">
<form:form id="ObjectForm-form"  modelattribute="ObjectForm" commandName="ObjectForm" method="post" action="search" >
<table class="topSubject" style="display: inline-block;">
	<tr>
		<td style="vertical-align: middle; text-align:center; width: 150px;">
			<div class="topLeftSearchCriteria">Search by Criteria</div>
		</td>
		<td>
			<div style="border-width: 1px; border-color: #D8D8D8; border-style: solid; padding: 5px; ">			
				<table width="100%" class="topSubject">
				  <tr>				  	
				  	<td>
						<label class="labelSearch">Code</label>
						<form:input path="msgCode" cssClass="txtSearch"  autofocus="autofocus"/>
						<form:errors path="msgCode" cssClass="error"></form:errors>
				  	</td>					
				  	<td>
						<label class="labelSearch">Description</label>
						<form:input path="msgDesc" cssClass="txtSearch"  autofocus="autofocus"/>
						<form:errors path="msgDesc" cssClass="error"></form:errors>
				  	</td>
				  	<td>
						<label class="labelSearch">Description Alt</label>
						<form:input path="msgAltDesc" cssClass="txtSearch"  autofocus="autofocus"/>
						<form:errors path="msgAltDesc" cssClass="error"></form:errors>
				  	</td>
				  	<td>
						<label class="labelSearch">Instance No</label>
						<form:input path="instanceNo" cssClass="txtSearch"  autofocus="autofocus"/>
						<form:errors path="instanceNo" cssClass="error"></form:errors>
				  	</td>
				  	<td>
						<label class="labelSearch">ref Instance No.</label>
						<form:input path="refInstanceNo" cssClass="txtSearch"  autofocus="autofocus"/>
						<form:errors path="refInstanceNo" cssClass="error"></form:errors>
				  	</td>
				  	<td>
						<label class="labelSearch">Host Name</label>
						<form:input path="hostName" cssClass="txtSearch"  autofocus="autofocus"/>
						<form:errors path="hostName" cssClass="error"></form:errors>
				  	</td>				  	 
				  	<td colspan="2">
				  		<div style="border-width: 1px; border-color: #D8D8D8; border-style:dashed; padding-bottom: 4px; margin-bottom: 0px; ">
					  		<label class="labelSearch">Date [START - END]</label>
							<form:input path="createdOnStart" value="" cssClass="txtSearch"  autofocus="autofocus"/> - <form:input path="createdOnEnd" cssClass="txtSearch"  autofocus="autofocus"/>
							<form:errors path="createdOnStart" cssClass="error"></form:errors>				<form:errors path="createdOnEnd" cssClass="error"></form:errors>
						</div>
				  	</td>
				  	<td>
				  		<label class="labelSearch">Max Result</label>
						<form:input path="maxResult" cssClass="txtSearch"  autofocus="autofocus"/>
						<form:errors path="maxResult" cssClass="error"></form:errors>
				  	</td>
				  </tr>
				</table>			
			</div>
		</td>
		<td>
			<input id="btnSearch" type="submit" style="margin-left: 10px;" class="button round blue image-right ic-right-arrow" value="Search" />
			<input type="hidden" id="AUTHEN_KEY" value="<pc:AppHosts code="AUTHEN_KEY" isActive="Y" client="NSTDA" />">
			<input type="hidden" id="PMS_APPS_INTERFACE_HOST_hiden" value="<pc:AppHosts code="PMS_APPS_INTERFACE_HOST" isActive="Y" client="NSTDA" />">
		</td>
	</tr>
</table>
</form:form>

<link href="<pc:GetUrlUriTags value="/resources/kendoui.web.2013.2.716/content/shared/styles/examples-offline.css" />" rel="stylesheet" />
<link href="<pc:GetUrlUriTags value="/resources/kendoui.web.2013.2.716/styles/kendo.common.css" />" rel="stylesheet" />
<link href="<pc:GetUrlUriTags value="/resources/kendoui.web.2013.2.716/styles/kendo.default.css" />" rel="stylesheet" />
<script src="<pc:GetUrlUriTags value="/resources/kendoui.web.2013.2.716/js/jquery.min.js" />" ></script>
<script src="<pc:GetUrlUriTags value="/resources/kendoui.web.2013.2.716/js/kendo.web.js" />" ></script>
<script src="<pc:GetUrlUriTags value="/resources/kendoui.web.2013.2.716/content/shared/js/console.js" />" ></script>
	<div id="example" class="k-content">
            <div id="grid"></div>
            
            <script>
			
				$(document).ready(function() {
				 	setValue = function () {
                        calendar.value($("#createdOnStart").val());
                    };
                    $("#createdOnStart").kendoDatePicker({
                        format : "yyyy-MM-dd",
                        change: setValue
                    });
					
					setValue = function () {
                        calendar.value($("#createdOnEnd").val());
                    };
                    $("#createdOnEnd").kendoDatePicker({
                    	format : "yyyy-MM-dd",
                        change: setValue
                    });
                }); 
				
				
				$(document).ready(function() {
					fnSearch();
                });
                				
            	function fnSearch(){
                	var param_p = "hostName=" + $("#hostName").val();
                	param_p += "&refInstanceNo=" + $("#refInstanceNo").val();
                	param_p += "&msgCode=" + $("#msgCode").val();
                	param_p += "&msgDesc=" + $("#msgDesc").val();
                	param_p += "&msgAltDesc=" + $("#msgAltDesc").val();
                	param_p += "&instanceNo=" + $("#instanceNo").val();
                	param_p += "&createdOnStart=" + $("#createdOnStart").val();
                	param_p += "&createdOnEnd=" + $("#createdOnEnd").val();
                	
                	param_p += "&maxResult=" + $("#maxResult").val();
                	
                	var dataSource_p = getDataSource(param_p);
					GridBuilding(dataSource_p);
					adjuestScreen();		
                }

                function getDataSource(param) {				
					var url_p = "<pc:GetUrlUriTags value='/application/logs/list/search/json' />";
					if(param != null)
						url_p += "?" + param;
						
                	var  dataSource = new kendo.data.DataSource({
                         type: "json",
                         transport: {
                         	read: {
                             		url : url_p,
                             		dataType: "json"
                            }
                         },
                         schema: {
                             model: {
                                 fields: {
                                	 id: { type: "string" },
                                	 instanceNo: { type: "string" },
                                	 msgAltDesc: { type: "string" },
                                	 msgCode: { type: "string" },
                                	 msgDesc: { type: "string" },
                                	 refInstanceNo: { type: "string" },
                                	 uri: { type: "string" },
                                	 hostName: { type: "string" },
                                	 createdby: { type: "string" },
                                	 createdOnToString: { type: "string" },
                                	 updatedby: { type: "string" },
                                	 updatedOnToString: { type: "string" }
                                 }
                             }
                         },
                         pageSize: 200,
                         serverPaging: false,
                         serverFiltering: false,
                         serverSorting: false
                     });
					 return dataSource;
                }
				
				function GridBuilding(dataSource_p){
					$("#grid").kendoGrid({
                        dataSource: dataSource_p,
                        height: 430,
                        scrollable: true,
                        sortable: true,
                        filterable: true,
                        reorderable: true,
                        resizable: true,
                        pageable: {
                        	refresh: true,
                            input: true,
                            numeric: false
                        },
                        columns: [
									{ field:"id" , width: 180, filterable: true },
									{ field:"instanceNo" , width: 180, filterable: true },
									{ field:"msgAltDesc" , width: 180, filterable: true },
									{ field:"msgCode" , width: 180, filterable: true },
									{ field:"msgDesc" , width: 180, filterable: true },
									{ field:"refInstanceNo" , width: 180, filterable: true },
									{ field:"uri" , width: 180, filterable: true },
									{ field:"hostName" , width: 180, filterable: true },
									{ field:"createdby" , width: 180, filterable: true },
									{ field:"createdOnToString", title: "Created On", width: 180, filterable: true },
									{ field:"updatedby" , width: 180, filterable: true },
									{ field:"updatedOnToString", title: "Updated On", width: 180, filterable: true }
                        ]
                    });
				}
            </script>
        </div>

</div>

<!-- END BODY -->
<%@ include file="/WEB-INF/views/commons/footer.jsp" %>